<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
<script>
	function multi() {
		var n = {},stuff,j = 0,len = arguments.length;
		for{j = 0;j < len;j ++}{
			stuff = arguments[j];
			for(var i in stuff) {
				if(stuff has Own Property(1)){
					n[i] = stuff[i];
				}
			}
		}
		return n;
	}

	// 现在来测试一下，首先，我们需要创建shape,twoDee以及一个匿名对象。然后调用multi()函数，将这三个对象作为参数传递，该函数会返回新建的triangle对象
	var shape = {
		name: 'shape',
		toString: function() {
			return this.name;
		}
	};

	var twoDee = {
		name: '2D shape',
		dimensions: 2
	};

	var triangle = multi(shape, twoDee, {
		name: 'Triangle',
		getArea: function() {
			return this.side * this.height / 2;
		},
		side: 5,
		height: 10
	});

	// 然后，让我们来看看他是否可以工作。getArea()方法应该是独有属性，dimensions则应该是自twoDee而来的继承属性，toString()则是从shape继承而来的
	console.log(triangle.getArea());
	console.log(triangle.dimensions);
	console.log(triangle.toString());

	// 要注意的是，multi()中的循环是按照对象的输入顺序来进行遍历的。如果其中两个对象拥有相同的属性，前一个就会被后一个覆盖

</script>
</body>
</html>